﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/MasterPage.Master" CodeBehind="Admin.aspx.vb" Inherits="RUHResturants.Admin" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Label ID="Label1" runat="server" 
        Text="Welcome To Administrator Control Panel " Font-Bold="True" 
        Font-Size="Large"></asp:Label>
    <br />
    <br />
    
    <b>Restaurants List<br />
    </b>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
        DataKeyNames="Id" DataSourceID="RestData" ForeColor="#333333" GridLines="None">
        <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
        <Columns>
            <asp:CommandField ShowDeleteButton="True" />
            <asp:BoundField DataField="Id" HeaderText="ID" InsertVisible="False" 
                ReadOnly="True" SortExpression="Id" />
            <asp:BoundField DataField="RestName" HeaderText="Restaurant Name" 
                SortExpression="RestName" />
            <asp:BoundField DataField="Address" HeaderText="Address" 
                SortExpression="Address" />
            <asp:BoundField DataField="Telephone" HeaderText="Telephone" 
                SortExpression="Telephone" />
            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
            <asp:BoundField DataField="PriceLevel" HeaderText="Price Level" 
                SortExpression="PriceLevel" />
            <asp:BoundField DataField="LuxuryLevel" HeaderText="Luxury Level" 
                SortExpression="LuxuryLevel" />
            <asp:BoundField DataField="EatingService" HeaderText="Eating Service" 
                SortExpression="EatingService" />
            <asp:BoundField DataField="WorkingHours" HeaderText="Working Hours" 
                SortExpression="WorkingHours" />
            <asp:BoundField DataField="UserName" HeaderText="User Name" 
                SortExpression="UserName" />
                
                  <asp:TemplateField ShowHeader="False">
             <ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("id", "Details.aspx?Id={0}") %>' 
                        Text="Details"></asp:HyperLink>
            </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
    <asp:SqlDataSource ID="RestData" runat="server" 
        ConnectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\RUHRestaurantsDB.accdb;Persist Security Info=True" 
        DeleteCommand="DELETE FROM [Resturants] WHERE [Id] = ?" 
        InsertCommand="INSERT INTO [Resturants] ([Id], [RestName], [Address], [Telephone], [Email], [PriceLevel], [LuxuryLevel], [EatingService], [WorkingHours], [UserName]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" 
        OldValuesParameterFormatString="original_{0}" ProviderName="System.Data.OleDb" 
        SelectCommand="SELECT * FROM [Resturants]" 
        
    UpdateCommand="UPDATE [Resturants] SET [RestName] = ?, [Address] = ?, [Telephone] = ?, [Email] = ?, [PriceLevel] = ?, [LuxuryLevel] = ?, [EatingService] = ?, [WorkingHours] = ?, [UserName] = ? WHERE [Id] = ?">
        <DeleteParameters>
            <asp:Parameter Name="original_Id" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="RestName" Type="String" />
            <asp:Parameter Name="Address" Type="String" />
            <asp:Parameter Name="Telephone" Type="String" />
            <asp:Parameter Name="Email" Type="String" />
            <asp:Parameter Name="PriceLevel" Type="String" />
            <asp:Parameter Name="LuxuryLevel" Type="String" />
            <asp:Parameter Name="EatingService" Type="String" />
            <asp:Parameter Name="WorkingHours" Type="String" />
            <asp:Parameter Name="UserName" Type="String" />
            <asp:Parameter Name="original_Id" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="Id" Type="Int32" />
            <asp:Parameter Name="RestName" Type="String" />
            <asp:Parameter Name="Address" Type="String" />
            <asp:Parameter Name="Telephone" Type="String" />
            <asp:Parameter Name="Email" Type="String" />
            <asp:Parameter Name="PriceLevel" Type="String" />
            <asp:Parameter Name="LuxuryLevel" Type="String" />
            <asp:Parameter Name="EatingService" Type="String" />
            <asp:Parameter Name="WorkingHours" Type="String" />
            <asp:Parameter Name="UserName" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
    <br />
    
    <br />
    <b>Comments List<br />
    </b>
    <asp:GridView ID="GridView2" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
        DataKeyNames="Id" DataSourceID="CommentsData" ForeColor="#333333" 
        GridLines="None">
        <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
        <Columns>
            <asp:CommandField ShowDeleteButton="True" />
            <asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" 
                ReadOnly="True" SortExpression="Id" />
            <asp:BoundField DataField="RestId" HeaderText="RestId" 
                SortExpression="RestId" />
            <asp:BoundField DataField="UserId" HeaderText="UserId" 
                SortExpression="UserId" />
            <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
            <asp:BoundField DataField="Comments" HeaderText="Comments" 
                SortExpression="Comments" />
            <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
            <asp:BoundField DataField="Rate" HeaderText="Rate" SortExpression="Rate" />
            
             <asp:TemplateField ShowHeader="False">
             <ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("RestId", "Details.aspx?Id={0}") %>' 
                        Text="Details"></asp:HyperLink>
            </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
    <asp:SqlDataSource ID="CommentsData" runat="server" 
        ConnectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\RUHRestaurantsDB.accdb;Persist Security Info=True" 
     
        OldValuesParameterFormatString="original_{0}" ProviderName="System.Data.OleDb" 
        SelectCommand="SELECT * FROM [Comments]" 
    DeleteCommand="DELETE FROM [Comments] WHERE [Id] = ?" 
    InsertCommand="INSERT INTO [Comments] ([Id], [RestId], [UserId], [Title], [Comments], [Date], [Rate]) VALUES (?, ?, ?, ?, ?, ?, ?)" 
    UpdateCommand="UPDATE [Comments] SET [RestId] = ?, [UserId] = ?, [Title] = ?, [Comments] = ?, [Date] = ?, [Rate] = ? WHERE [Id] = ?">
        <DeleteParameters>
            <asp:Parameter Name="original_Id" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="RestId" Type="Int32" />
            <asp:Parameter Name="UserId" Type="String" />
            <asp:Parameter Name="Title" Type="String" />
            <asp:Parameter Name="Comments" Type="String" />
            <asp:Parameter Name="Date" Type="DateTime" />
            <asp:Parameter Name="Rate" Type="String" />
            <asp:Parameter Name="original_Id" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="Id" Type="Int32" />
            <asp:Parameter Name="RestId" Type="Int32" />
            <asp:Parameter Name="UserId" Type="String" />
            <asp:Parameter Name="Title" Type="String" />
            <asp:Parameter Name="Comments" Type="String" />
            <asp:Parameter Name="Date" Type="DateTime" />
            <asp:Parameter Name="Rate" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
    <br />
    <br />
</asp:Content>
